# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Alexander Rødseth <rodseth@gmail.com>

pkgname=python-sh
pkgver=1.14.3
pkgrel=2
pkgdesc='Subprocess interface that allows you to call any program as if it were a function'
arch=('any')
url='https://pypi.python.org/pypi/sh'
license=('MIT')
depends=('python')
makedepends=('python-setuptools')
checkdepends=('lsof' 'python-pytest')
source=("https://pypi.io/packages/source/s/sh/sh-$pkgver.tar.gz")
sha512sums=('f78b418a396b78b4d303846da222eedc7525dee8d200bf96d48054d91a82671d40e0f1f82eb406b16016752ff95c3b2360075974abc3a5a814b8cfe70528231a')
b2sums=('e570b3d51bbabebc90a575aaa502dc448f5049caf7485763f7ca84bd30a1e19f37441e4217074cb75ee0094600d328b59693fffdb0647479478246e58c0f00a7')

build() {
  cd sh-$pkgver
  python setup.py build
}

check() {
  cd sh-$pkgver
  export PYTHONPATH="build:${PYTHONPATH}"
  # test_no_fd_leak: AssertionError: 27 != 25
  pytest test.py --deselect test.py::MiscTests::test_no_fd_leak
}

package() {
  cd sh-$pkgver
  python setup.py install -O1 --root="$pkgdir"
  install -vDm 644 LICENSE.txt "$pkgdir"/usr/share/licenses/python-sh/LICENSE
  install -vDm 644 {README.rst,CHANGELOG.md} \
    -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim:set ts=2 sw=2 et:
